package com.bzg.baseSpringComponent.eventPublisher;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;

public class Config {

	// 注册一个监听器
	@Bean
	public ApplicationListener<ApplicationEvent> register() {
		return new ApplicationListener<ApplicationEvent>() {
			@Override
			public void onApplicationEvent(ApplicationEvent event) {
				System.out.println("监听到事件" + event.getSource());
			}
		};
	}

}
